package xin.marcher.module.inventory.mq.producer;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import xin.marcher.module.common.constants.RocketMqConstant;
import xin.marcher.module.inventory.domain.request.InventoryRequest;

/**
 * 分桶元数据缓存同步刷新消息
 *
 *
 */
@Slf4j
@Component
public class BucketRefreshProducer {


    @Autowired
    private DefaultProducer defaultProducer;

    /**
     * 分桶元数据缓存同步刷新消息 MQ生产
     *
     * @param inventoryRequest
     */
    public void sendBucketOffline(InventoryRequest inventoryRequest) {
        // 分桶元数据缓存
        defaultProducer.sendAsyncMessage(RocketMqConstant.BUCKET_CACHE_REFRESH_TOPIC,
                JSONObject.toJSONString(inventoryRequest), "分桶元数据同步刷新");
    }
}
